home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\INCLUDE\IRC.H < prev    next >
C/C++ Source or Header  |  1995-01-04  |  7KB  |  342 lines

  1. /*
  2.  * irc.h: header file for all of ircII! 
  3.  *
  4.  * Written By Michael Sandrof
  5.  * Copyright(c) 1990 
  6.  *
  7.  * See the COPYRIGHT file, or do a HELP IRCII COPYRIGHT 
  8.  *
  9.  * @(#)$Id: irc.h,v 1.29 1994/10/16 00:31:36 mrg Stab $
  10.  */
  11.  
  12. #ifndef __irc_h
  13. #define __irc_h
  14.  
  15. #define IRCII_COMMENT   "this is a bug free client.  honest"
  16.  
  17. #ifdef __MSDOS__
  18. #define IRCRC_NAME "/irc.rc"
  19. #else
  20. #define IRCRC_NAME "/.ircrc"
  21. #endif
  22.  
  23. /*
  24.  * Here you can set the in-line quote character, normally backslash, to
  25.  * whatever you want.  Note that we use two backslashes since a backslash is
  26.  * also C's quote character.  You do not need two of any other character.
  27.  */
  28. #define QUOTE_CHAR '\\'
  29.  
  30. #if defined(ISC30)        /* for some reason it doesn't get defined */
  31. # define _POSIX_SOURCE
  32. #endif /* ISC30 */
  33.  
  34. #include "defs.h"
  35. #include "config.h"
  36. #include <stdio.h>
  37. #include <ctype.h>
  38. #ifdef _Windows
  39. #include <winsock.h>
  40. #include <signal.h>
  41. #else
  42. #include <sys/types.h>
  43. #include <sys/socket.h>
  44. #ifndef WINS
  45. #include <netinet/in.h>
  46. #else
  47. #include <sys/twg_config.h>
  48. #include <sys/in.h>
  49. #undef server
  50. #endif
  51. #include <arpa/inet.h>
  52. #include <signal.h>
  53. #include <sys/param.h>
  54. #endif
  55.  
  56. #ifdef TIME_WITH_SYS_TIME
  57. # include <sys/time.h>
  58. # include <time.h>
  59. #else
  60. # ifdef HAVE_SYS_TIME_H
  61. #  include <sys/time.h>
  62. # else
  63. #  include <time.h>
  64. # endif /* HAVE_SYS_TIME_H */
  65. #endif /* TIME_WITH_SYS_TIME */
  66.  
  67. #ifdef HAVE_SYS_FCNTL_H
  68. # include <sys/fcntl.h>
  69. #else
  70. # ifdef HAVE_FCNTL_H
  71. #  include <fcntl.h>
  72. # endif /* HAVE_FCNTL_H */
  73. #endif /* HAVE_SYS_FCNTL_H */
  74.  
  75.  
  76. /* machines we don't want to use <unistd.h> on 'cause its broken */
  77. #if defined(pyr) || defined(_SEQUENT_) || defined(IN_EXEC_C)
  78. # undef HAVE_UNISTD_H
  79. #endif
  80.  
  81. #ifdef HAVE_UNISTD_H
  82. # include <unistd.h>
  83. #endif
  84.  
  85. #ifdef HAVE_SYS_FILE_H
  86. # include <sys/file.h>
  87. #endif
  88.  
  89. #ifdef HAVE_NETDB_H
  90. # include <netdb.h>
  91. #endif
  92.  
  93. #if defined(__QNX__)
  94. # include <sys/select.h>
  95. # include <unix.h>
  96. # define BROKEN_GETPGRP 1
  97. # define USE_STDARG_H
  98. #endif
  99.  
  100. #ifdef HAVE_STDARG_H
  101. # include <stdarg.h>
  102. #endif
  103.  
  104. #include "irc_std.h"
  105. #include "debug.h"
  106.  
  107. /* these define what characters do, inverse, underline, bold and all off */
  108. #define REV_TOG        '\026'        /* ^V */
  109. #define UND_TOG        '\037'        /* ^_ */
  110. #define BOLD_TOG    '\002'        /* ^B */
  111. #define ALL_OFF        '\017'        /* ^O */
  112.  
  113. #define IRCD_BUFFER_SIZE    1024
  114. #define BIG_BUFFER_SIZE        (IRCD_BUFFER_SIZE * 2)
  115.  
  116. #ifndef INPUT_BUFFER_SIZE
  117. #define INPUT_BUFFER_SIZE    (IRCD_BUFFER_SIZE / 4)
  118. #endif
  119.  
  120. #ifdef notdef
  121. # define DAEMON_UID 1
  122. #endif
  123.  
  124. #define NICKNAME_LEN 9
  125. #define NAME_LEN 80
  126. #define REALNAME_LEN 50
  127. #define PATH_LEN 1024
  128.  
  129. #if defined(__hpux) || defined(hpux) || defined(_HPUX_SOURCE)
  130. # undef HPUX
  131. # define HPUX
  132. # ifndef HPUX7
  133. #  define killpg(pgrp,sig) kill(-pgrp,sig)
  134. # endif
  135. #endif
  136.  
  137. #if defined(__sgi)
  138. # define USE_TERMIO
  139. #endif /* __sgi */
  140.  
  141. #ifdef DGUX
  142. # define USE_TERMIO
  143. # define inet_addr(x) inet_network(x)    /* dgux lossage */
  144. #endif /* DGUX */
  145.  
  146. /*
  147.  * Lame Linux doesn't define X_OK in a non-broken header file, so
  148.  * we define it here.. 
  149.  */
  150. #if (defined(linux) || defined(__BORLANDC__)) && !defined(X_OK)
  151. # define X_OK  1
  152. # ifdef __BORLANDC__
  153. #  define F_OK 0
  154. #  define W_OK 2
  155. #  define R_OK 4
  156. # endif
  157. #endif /* linux */
  158.  
  159. #if __osf__
  160. # define _BSD
  161. #endif
  162.  
  163. #if defined(UNICOS) && !defined(USE_TERMIO)
  164. # define USE_TERMIO
  165. #endif /* UNICOS */
  166.  
  167. /* systems without getwd() can lose, if this dies */
  168. #if defined(NEED_GETCWD)
  169. # define getcwd(b, c)    getwd(b);
  170. #endif
  171.  
  172. #if defined(ISC22) || defined(ISC30)
  173. # define USE_TERMIO
  174. # define ISC
  175. #endif /* ISC22 || ISC30 */
  176.  
  177. #if defined(_AUX_SOURCE) && !defined(USE_TERMIO)
  178. # define USE_TERMIO
  179. #endif
  180.  
  181. #ifdef MAIL_DIR
  182. # undef UNIX_MAIL
  183. # define UNIX_MAIL MAIL_DIR
  184. #endif
  185.  
  186. /* flags used by who() and whoreply() for who_mask */
  187. #define WHO_OPS        0x0001
  188. #define WHO_NAME    0x0002
  189. #define WHO_ZERO    0x0004
  190. #define WHO_CHOPS    0x0008
  191. #define WHO_FILE    0x0010
  192. #define WHO_HOST    0x0020
  193. #define WHO_SERVER    0x0040
  194. #define    WHO_HERE    0x0080
  195. #define    WHO_AWAY    0x0100
  196. #define    WHO_NICK    0x0200
  197. #define    WHO_LUSERS    0x0400
  198. #define    WHO_REAL    0x0800
  199.  
  200. /*
  201.  (* Some defines in case we're using IRCII setuid->root, so that we can bind
  202.  * to privileged ports. This will allow future IRC nets to verify the true
  203.  * identity of users much more reliably.
  204.  */
  205. #ifdef PRIV_PORT
  206. # define    open        ruid_open
  207. # define    fopen        ruid_fopen
  208. # define    system        ruid_system
  209. # define    unlink        ruid_unlink
  210. # define    stat_file    ruid_stat
  211. #ifdef EOF    /* defined if stdio.h has been included */
  212. extern FILE *ruid_fopen();
  213. # endif /*EOF*/
  214. extern    int    ruid_open();
  215. extern    int    ruid_system();
  216. extern    int    ruid_unlink();
  217. #else
  218. # define stat_file stat
  219. #endif /*PRIV_PORT*/
  220.  
  221. /*
  222.  * declared in irc.c 
  223.  */
  224. extern    char    *cut_buffer;
  225. extern    char    oper_command;
  226. extern    int    irc_port;
  227. extern    int    send_text_flag;
  228. extern    int    irc_io_loop;
  229. extern    int    break_io_processing;
  230. extern    int    use_flow_control;
  231. extern    char    *joined_nick;
  232. extern    char    *public_nick;
  233. extern    char    empty_string[];
  234.  
  235. extern    char    irc_version[];
  236. extern    char    internal_version[];
  237. extern    char    FAR buffer[];
  238. extern    char    FAR nickname[];
  239. extern    char    *ircrc_file;
  240. extern    char    FAR hostname[];
  241. extern    char    FAR realname[];
  242. extern    char    FAR username[];
  243. extern    char    *send_umode;
  244. extern    char    *last_notify_nick;
  245. extern    int    away_set;
  246. extern    int    background;
  247. extern    char    *my_path;
  248. extern    char    *irc_path;
  249. extern    char    *irc_lib;
  250. extern    char    *args_str;
  251. extern    char    *invite_channel;
  252. extern    int    who_mask;
  253. extern    char    *who_name;
  254. extern    char    *who_host;
  255. extern    char    *who_server;
  256. extern    char    *who_file;
  257. extern    char    *who_nick;
  258. extern    char    *who_real;
  259. extern    char    *cannot_open;
  260. extern    char    global_all_off[];
  261. extern    int    dumb;
  262. extern    int    use_input;
  263. extern    time_t    idle_time;
  264. extern    int    waiting;
  265. extern    char    wait_nick[];
  266. extern    char    whois_nick[];
  267. extern    char    lame_wait_nick[];
  268. extern    char    **environ;
  269. extern    int    current_numeric;
  270. extern    int    new_select();
  271.  
  272. extern    struct    in_addr    local_ip_address;
  273. extern    int    irc_io();
  274. extern    int    dgets();
  275. extern    time_t    dgets_timeout();
  276. extern    void    help();
  277. extern    char    *current_channel();
  278. extern    void    new_stty();
  279. extern    int    wild_match();
  280. extern    char    *new_malloc();
  281. extern    void    do_server();
  282. extern    char    *get_server_nickname();
  283. extern  int     connect_by_number();
  284. extern    int    is_channel();
  285. extern    void    irc_exit();
  286. extern    void    new_close();
  287. extern    void    beep_em();
  288. extern    void    set_socket_options __P((int));
  289. extern    char    *next_expr __P((char **, char));
  290.  
  291. typedef    struct    WhoisStuffStru
  292. {
  293.     char    *nick;
  294.     char    *user;
  295.     char    *host;
  296.     char    *channel;
  297.     char    *channels;
  298.     char    *name;
  299.     char    *server;
  300.     char    *server_stuff;
  301.     char    *away;
  302.     int    oper;
  303.     int    chop;
  304.     int    not_on;
  305. }    WhoisStuff;
  306.  
  307. /* Moved into here, because some weird CC's can't do (void *) */
  308. typedef    struct    WhoisQueueStru
  309. {
  310.     char    *nick;            /* nickname of whois'ed person(s) */
  311.     char    *text;            /* additional text */
  312.     int    type;            /* Type of WHOIS queue entry */
  313.     /*
  314.      * called with func((WhoisStuff *)stuff,(char *) nick, (char *) text) 
  315.      */
  316.     void    (*func)();
  317.     struct    WhoisQueueStru    *next;/* next element in queue */
  318. }    WhoisQueue;
  319.  
  320. extern    char    *getenv();
  321.  
  322. #ifdef _Windows
  323. typedef long off_t;
  324. extern char *get_path(int iVal);
  325. #endif
  326.  
  327. #ifdef _Windows
  328. #define    define_big_buffer(x)    char *x = (char *) new_malloc(BIG_BUFFER_SIZE + 1)
  329. #define    free_big_buffer(x)    new_free(&x)
  330. #else
  331. #define    define_big_buffer(x)    char x[BIG_BUFFER_SIZE + 1]
  332. #define    free_big_buffer(x)    (0)
  333. #endif
  334.  
  335. #ifdef _Windows
  336. #define IS_FULL_PATH(x) (x[0] == '/' || x[0] == '\\' || (x[0] && x[1] == ':'))
  337. #else
  338. #define IS_FULL_PATH(x) (x[0] == '/')
  339. #endif
  340.  
  341. #endif /* __irc_h */
  342.